<?php
/**
 * Created by PhpStorm.
 * User: lullabies
 * Date: 2019/5/21
 * Time: 15:49
 */

namespace app\api\controller;
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept,fs-token");
header('Access-Control-Allow-Methods: GET, POST');
use app\api\validate\SmsCaptcha;
/**
 * @title 短信验证接口
 */
class Captcha extends  Base
{
    /**
     * @title 获取短信验证码
     * @description 获取短信验证码 默认6位数，失效时间为10分钟
     * @author 开发者
     * @url /api/captcha/sendRegisterSms
     * @method POST
     * @param name:phone type:char require:1 default:null  desc:手机号
     * @param name:pwd type:char require:1 default:null  desc:验证参数（实际就是手机号）
     */
    public function sendRegisterSms()
    {
        //获得提交的手机号和密码
        $phone = input('phone');
        $pwd=user_md5(input('pwd'));
        //手机号登陆验证
        (new SmsCaptcha())->goCheck();
        //引入短信验证方法
        $sms=new Sms();
        $sms->send($phone, $pwd);
    }
}